﻿using System;

namespace ScriptXCompiler
{
    public class JsonNameQuoteFlag
    {
        private bool _projectLevel;
        private bool? _classLevel;
        private bool? _methodLevel;

        public JsonNameQuoteFlag(bool projectLevel)
        {
            _projectLevel = projectLevel;
        }

        public void SetClassLevel(bool? classLevel)
        {
            _classLevel = classLevel;
        }

        public void SetMethodLevel(bool? methodLevel)
        {
            _methodLevel = methodLevel;
        }

        public bool RequireQuote()
        {
            if (_methodLevel.HasValue)
                return _methodLevel.Value;
            if (_classLevel.HasValue)
                return _classLevel.Value;
            return _projectLevel;
        }
    }
}
